package com.itita.ww2.model.enums;

public enum ResourceType {
	OIL("R011"), // 油
	STEEL("R012"), // 钢
	ELEC("R013"), // 电
	CASH("R014"), // 现金
	GOLD("R004"), // 金条
	;
	private String code;

	public String getValue() {
		return this.code;
	}

	private ResourceType(String code) {
		this.code = code;
	}

	public static ResourceType codeValueOf(String code) {
		for (ResourceType bt : values()) {
			if (bt.code.equals(code)) {
				return bt;
			}
		}
		return null;
	}

	public static ResourceType bdCodeValueOf(String bdCode) {
		String resCode = bdCode.replace("BA", "R");
		return codeValueOf(resCode);
	}
}
